package top.codervan.yygh.hosp.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.codervan.yygh.common.result.Result;
import top.codervan.yygh.hosp.service.DepartmentService;
import top.codervan.yygh.vo.hosp.DepartmentVo;

import java.util.List;

/**
 * @Author: van
 * @Date: 2022/2/20 19:05
 */
@Api(tags = "医院科室管理")
@RestController
@RequestMapping("/admin/hosp/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 根据医院的编号，查询医院所有科室列表
     * @param hoscode
     * @return
     */
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("getDeptList/{hoscode}")
    public Result getDeptList(@PathVariable String hoscode) {
        List<DepartmentVo> list = departmentService.findDeptTree(hoscode);
        return Result.ok(list);
    }
}
